package com.jxb.controller;

import com.jxb.producer.SpringProducer;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class TestController {

    @Resource
    private SpringProducer springProducer;

    @RequestMapping("simp")
    public Object sendSimp(String topic,String msg) {
        springProducer.sendMsg(topic,msg);
        return "普通消息发送成功！";
    }

    @RequestMapping("tra")
    public Object sendTra(String topic,String msg) {
        springProducer.sendMessageInTransaction(topic,msg);
        return "事务消息发送成功！";
    }



}
